# 168类符号到音符/时值/功能的映射（部分示例，需补全）
SYMBOL_TO_NOTE = {
    # 常规音符头
    "noteheadBlackOnLine": {"type": "note", "duration": "quarter"},
    "noteheadBlackInSpace": {"type": "note", "duration": "quarter"},
    "noteheadHalfOnLine": {"type": "note", "duration": "half"},
    "noteheadHalfInSpace": {"type": "note", "duration": "half"},
    "noteheadWholeOnLine": {"type": "note", "duration": "whole"},
    "noteheadWholeInSpace": {"type": "note", "duration": "whole"},
    
    # 小型音符头
    "noteheadBlackOnLineSmall": {"type": "note", "duration": "quarter"},
    "noteheadBlackInSpaceSmall": {"type": "note", "duration": "quarter"},
    "noteheadHalfOnLineSmall": {"type": "note", "duration": "half"},
    "noteheadHalfInSpaceSmall": {"type": "note", "duration": "half"},
    "noteheadWholeOnLineSmall": {"type": "note", "duration": "whole"},
    "noteheadWholeInSpaceSmall": {"type": "note", "duration": "whole"},
    
    # 二全音符
    "noteheadDoubleWholeOnLine": {"type": "note", "duration": "breve"},
    "noteheadDoubleWholeInSpace": {"type": "note", "duration": "breve"},
    "noteheadDoubleWholeOnLineSmall": {"type": "note", "duration": "breve"},
    "noteheadDoubleWholeInSpaceSmall": {"type": "note", "duration": "breve"},
    
    # 休止符
    "restDoubleWhole": {"type": "rest", "duration": "breve"},
    "restWhole": {"type": "rest", "duration": "whole"},
    "restHalf": {"type": "rest", "duration": "half"},
    "restQuarter": {"type": "rest", "duration": "quarter"},
    "rest8th": {"type": "rest", "duration": "eighth"},
    "rest16th": {"type": "rest", "duration": "16th"},
    "rest32nd": {"type": "rest", "duration": "32nd"},
    "rest64th": {"type": "rest", "duration": "64th"},
    "rest128th": {"type": "rest", "duration": "128th"},
    
    # 小节线、连线等
    "beam": {"type": "structure", "function": "beam"},
    "tie": {"type": "structure", "function": "tie"},
    "stem": {"type": "structure", "function": "stem"},
    
    # 谱号
    "clefG": {"type": "clef", "function": "G"},
    "clefF": {"type": "clef", "function": "F"},
    "clefC": {"type": "clef", "function": "C"},
    
    # 装饰音符等
    "flag8thUp": {"type": "note", "duration": "eighth"},
    "flag8thDown": {"type": "note", "duration": "eighth"},
    "flag16thUp": {"type": "note", "duration": "16th"},
    "flag16thDown": {"type": "note", "duration": "16th"},
    
    # 调号
    "keyFlat": {"type": "key", "function": "flat"},
    "keySharp": {"type": "key", "function": "sharp"},
    "keyNatural": {"type": "key", "function": "natural"},
    
    # 升降记号
    "accidentalFlat": {"type": "accidental", "function": "flat"},
    "accidentalSharp": {"type": "accidental", "function": "sharp"},
    "accidentalNatural": {"type": "accidental", "function": "natural"},
    "accidentalDoubleSharp": {"type": "accidental", "function": "doublesharp"},
    "accidentalDoubleFlat": {"type": "accidental", "function": "doubleflat"},
    
    # 小型升降记号
    "accidentalFlatSmall": {"type": "accidental", "function": "flat"},
    "accidentalSharpSmall": {"type": "accidental", "function": "sharp"},
    "accidentalNaturalSmall": {"type": "accidental", "function": "natural"},
    
    # 五线谱线和加线
    "staff": {"type": "structure", "function": "staff"},
    "ledgerLine": {"type": "structure", "function": "ledger"},
    "legerLine": {"type": "structure", "function": "ledger"}
}

# 168类符号名列表（与模型类别顺序一致）
CLASS_NAMES = [
    "brace", "ledgerLine", "legerLine", "repeatDot", "segno", "coda", "clefG", "clefCAlto", "clefC", "clefCTenor", "clefF", "clefUnpitchedPercussion", "clef8", "numeral8", "clef15", "timeSig0", "numeral0", "timeSig1", "numeral1", "timeSig2", "numeral2", "timeSig3", "numeral3", "timeSig4", "numeral4", "timeSig5", "numeral5", "timeSig6", "numeral6", "timeSig7", "numeral7", "timeSig8", "timeSig9", "numeral9", "timeSigCommon", "timeSigCutCommon", "noteheadBlackOnLine", "noteheadFullSmall", "noteheadBlackOnLineSmall", "noteheadBlackInSpace", "noteheadBlackInSpaceSmall", "noteheadHalfOnLine", "noteheadHalfSmall", "noteheadHalfOnLineSmall", "noteheadHalfInSpace", "noteheadHalfInSpaceSmall", "noteheadWholeOnLine", "noteheadWhole", "noteheadWholeOnLineSmall", "noteheadWholeInSpace", "noteheadWholeInSpaceSmall", "noteheadDoubleWholeOnLine", "noteheadDoubleWholeOnLineSmall", "noteheadDoubleWholeInSpace", "noteheadDoubleWholeInSpaceSmall", "augmentationDot", "stem", "tremolo1", "tremoloMark", "tremolo2", "tremolo3", "tremolo4", "tremolo5", "flag8thUp", "flag8thUpSmall", "flag16thUp", "flag32ndUp", "flag64thUp", "flag128thUp", "flag8thDown", "flag8thDownSmall", "flag16thDown", "flag32ndDown", "flag64thDown", "flag128thDown", "accidentalFlat", "accidentalFlatSmall", "accidentalNatural", "accidentalNaturalSmall", "accidentalSharp", "accidentalSharpSmall", "accidentalDoubleSharp", "accidentalDoubleFlat", "keyFlat", "keyNatural", "keySharp", "articAccentAbove", "articulationAccent", "articAccentBelow", "articStaccatoAbove", "articulationStaccato", "articStaccatoBelow", "articTenutoAbove", "articulationTenuto", "articTenutoBelow", "articStaccatissimoAbove", "articStaccatissimoBelow", "articMarcatoAbove", "articulationMarcatoAbove", "articMarcatoBelow", "articulationMarcatoBelow", "fermataAbove", "fermataBelow", "caesura", "restDoubleWhole", "restWhole", "restHalf", "restQuarter", "rest8th", "rest16th", "rest32nd", "rest64th", "rest128th", "restHNr", "numeral", "dynamicP", "dynamicLetterP", "dynamicM", "dynamicLetterM", "dynamicF", "dynamicLetterF", "dynamicS", "dynamicLetterS", "dynamicZ", "dynamicLetterZ", "dynamicR", "dynamicLetterR", "graceNoteAcciaccaturaStemUp", "graceNoteAppoggiaturaStemUp", "graceNoteAcciaccaturaStemDown", "graceNoteAcciaccatura", "graceNoteAppoggiaturaStemDown", "ornamentTrill", "ornamentTurn", "ornamentTurnInverted", "ornamentMordent", "stringsDownBow", "stringsUpBow", "arpeggiato", "arpeggio", "keyboardPedalPed", "keyboardPedalUp", "tuplet3", "tuplet6", "fingering0", "fingering1", "fingering2", "fingering3", "fingering4", "fingering5", "slur", "beam", "tie", "restHBar", "dynamicCrescendoHairpin", "dynamicDiminuendoHairpin", "tuplet1", "tuple", "tuplet2", "tuplet4", "tuplet5", "tuplet7", "tuplet8", "tuplet9", "tupletBracket", "tupleBracket", "staff", "ottavaBracket"
] 